//
//  ViewController.swift
//  demo2-大小不一堆叠collectionView
//
//  Created by 刘文超 on 2020/5/30.
//  Copyright © 2020 刘文超. All rights reserved.
//

import UIKit

private let cellID = "cellID"
private let SCREENW:CGFloat = UIScreen.main.bounds.width
private let SCREENH:CGFloat = UIScreen.main.bounds.height
private let ItemHeight:CGFloat = 150
class ViewController: UIViewController {

    
    private  lazy var collectionView:UICollectionView = {[weak self] in
        let layout = BezziDifferentfoldLayout.init()
        let view = UICollectionView.init(frame: CGRect.zero, collectionViewLayout: layout)
        view.delegate = self
        view.dataSource = self
        view.backgroundColor = UIColor.white
        view.register(UICollectionViewCell.self, forCellWithReuseIdentifier: cellID)
        return view
    }()
    
    override func viewDidLoad() {
        super.viewDidLoad()
    
        view.addSubview(collectionView)
        collectionView.frame = CGRect(x: 0, y: 0, width: SCREENW, height: SCREENH)
       
    }


}


extension ViewController:UICollectionViewDelegate,UICollectionViewDataSource{
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return 10
    }
    func numberOfSections(in collectionView: UICollectionView) -> Int {
        return 1
    }
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: cellID, for: indexPath)

        cell.backgroundColor = UIColor(red: CGFloat(Float(arc4random()%255) / 255), green: CGFloat(Float(arc4random()%255) / 255), blue: CGFloat(Float(arc4random()%255) / 255), alpha: 1)
        return cell
    }
    
}


class itemCell: UICollectionViewCell {
    
    //根据每个attribute。设置内容的显示效果
    override func apply(_ layoutAttributes: UICollectionViewLayoutAttributes) {
        super.apply(layoutAttributes)
//           let featuredHeight = BezziDifferentFoldConstants.Cell.expectCellHeight
//           let standardHeight = BezziDifferentFoldConstants.Cell.standCellHeight
//           let delta = 1 - ((featuredHeight - frame.height) / (featuredHeight - standardHeight))
//           let minAlpha: CGFloat = 0.3
//           let maxAlpha: CGFloat = 0.75

    }
}


